<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .box {
      width: 600px;
      height: 600px;
      background-color: pink;
      /* 
      grid布局是一种网格布局
      */
      display: grid;
      grid-template-columns: repeat(3, 100px);
      grid-template-rows: repeat(3, 100px);
      /* 
       grid-template-areas:用于定义区域，每行怎么排布 搭配 grid-area一起使用
       . 表示空白
       重复相邻几个 占几份
       先布局后书写
      */
      grid-template-areas:
        "a b . c"
        "one two two three"
        "e f . g"
      ;
    }

    .item {
      background-color: skyblue;
      border: 1px solid aqua;
    }

    .item:nth-child(1) {
      grid-area: a;
    }

    .item:nth-child(2) {
      grid-area: b;
    }

    .item:nth-child(3) {
      grid-area: c;
    }

    .item:nth-child(4) {
      grid-area: one;
    }

    .item:nth-child(5) {
      grid-area: two;
    }

    .item:nth-child(6) {
      grid-area: three;
    }

    .item:nth-child(7) {
      grid-area: e;
    }

    .item:nth-child(8) {
      grid-area: f;
    }

    .item:nth-child(9) {
      grid-area: g;
    }
  </style>
</head>

<body>
  <div class="box">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
    <div class="item">5</div>
    <div class="item">6</div>
    <div class="item">7</div>
    <div class="item">8</div>
    <div class="item">9</div>
  </div>
</body>

</html>